<?php
/**
 * Created by PhpStorm.
 * User: eugene
 * Date: 2018/3/12
 * Time: 18:23
 */

namespace App\Transformers;


use App\Models\MyStage;

class CarTransformer extends Transformer
{
    public function transform($item)
    {
        return [
            'id'=>$item->CarID,
            'car_id'=>$item->CarID,
            'name'=>$item->CarName,
            'thumb'=>$item->CarImgBig,
            'icon'=>$item->CarSign?:$item->CarImgBig,
            'color'=>'',
            'second_hand_sell_price'=>$item->CarPrice/2,
            'parked'=>0,
            'parked_index'=>0,
            'new_energy'=>$item->isNewEnergy()?1:0,
            'items'=>null,
        ];
    }
    
    public function forSell($item)
    {
        return [
            'id'=>$item->CarID,
            'name'=>$item->CarName,
            'thumb'=>$item->CarImg,
            'desc'=>$item->CarDesc,
            'color'=>'',
            'sell_price'=>$item->CarPrice,
            'new_energy'=>$item->isNewEnergy()?1:0,
            'income_per_hour'=>$item->CarCreditHour,
            'link'=>$item->link,
        ];
    }
    
}